package com.zyz.I_多线程.死锁;

/**
 * @author: vick
 * @Date: 2025/3/24
 * @Description:
 * @version: 1.0
 */
public class DeadLock implements Runnable{
    A a = new A();
    B b = new B();

    public void init() {
        Thread.currentThread().setName("主线程");
        a.test(b);
        System.out.println("进入主线程");
    }

    @Override
    public void run() {
        Thread.currentThread().setName("子线程");
        b.test(a);
        System.out.println("进入子线程");
    }

    public static void main(String[] args) {
        DeadLock deadLock = new DeadLock();
        new Thread(deadLock).start();
        deadLock.init();
    }
}
